import {
    ref,
    reactive,
    onBeforeMount,
    onMounted,
    onBeforeUpdate,
    onUpdated,
    onBeforeUnmount,
    onUnmounted,
} from "vue";
export default function() {
    let point = reactive({
            x: 0,
            y: 0
        })
        // 方法
    function savePoint(event) {
        point.x = event.pageX,
            point.y = event.pageY
    }
    onMounted(() => {
        window.addEventListener('click', savePoint)
    })
    onBeforeUnmount(() => {
            window.removeEventListener('click', savePoint)
        })
        //return 出要用的数据
    return point
}